package main

import (
	"fmt"
	"github.com/go-redis/redis"
)

var client *redis.Client

func initRedis() (err error) {
	client = redis.NewClient(&redis.Options{
		Addr:     "127.0.0.1:6379",
		Password: "a905982741",
		DB:       0,
	})
	_, err = client.Ping().Result()
	return
}

func main() {
	err := initRedis()
	if err != nil {
		fmt.Println("connect to redis failed, err:", err)
		return
	}
	fmt.Println("connect to redis successfully!")
}
